package cn.offer.controller;

import cn.offer.domain.YixuePaotuiAddress;
import cn.offer.domain.YixuePaotuiAddressExample;
import cn.offer.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author Snake Eyes
 * @PROJECT_NAME: paotui
 * @DESCRIPTION:
 * @USER: 11647
 * @DATE: 2021/5/19 10:55
 * @Email: 1164763541@qq.com
 */
@RestController
@RequestMapping("address")
public class AddressController {
    @Autowired
    private AddressService addressService;

    @GetMapping("list")
    public List findAll(Model model) {
        List<YixuePaotuiAddress> all = addressService.selectByExample(new YixuePaotuiAddressExample());
        model.addAttribute("list", all);
        return all;
    }

    @PostMapping("findById/{id}")
    public YixuePaotuiAddress findById(@PathVariable int id) {

        YixuePaotuiAddress address = addressService.selectByPrimaryKey(id);
        System.out.println(address);
        return address;
    } @PostMapping("update/{id}")
    public YixuePaotuiAddress update(@PathVariable int id) {

        YixuePaotuiAddress address = addressService.selectByPrimaryKey(id);
        System.out.println(address);
        return address;
    }
}
